package team.mai.antexpress.tests;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import team.mai.antexpress.services.LoginService;
import team.mai.antexpress.spring.beans.LoginBean;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"applicationContext.xml"})
public class LoginTest {

	@Autowired
	private LoginService target;

	private LoginBean login;

	@Before
	public void setUp() {
		login = new LoginBean();
	}

	@Test
	public void testLoginService(){
		String username = "Lief";
		String password = "1234";
		login.setUsername(username);
		login.setPassword(password);
		Assert.assertTrue(target.verifyLogin(login));
		login.setPassword("2345");
		Assert.assertFalse(target.verifyLogin(login));
	}
}
